<template>
  <view>
    <view class="u-flex user-box u-p-l-30 u-p-r-20 u-p-b-30" @click="$$route('/sub/user/login')">
      <view class="u-m-r-10">
        <u-avatar :src="pic" size="140"></u-avatar>
      </view>
      <view class="u-flex-1">
        <view class="u-font-18 u-p-b-20">uView ui</view>
        <view class="u-font-14 u-tips-color">微信号:test</view>
      </view>
      <view class="u-m-l-10 u-p-10">
        <u-icon name="scan" color="#969799" size="28"></u-icon>
      </view>
      <view class="u-m-l-10 u-p-10">
        <u-icon name="arrow-right" color="#969799" size="28"></u-icon>
      </view>
    </view>

    <view class="u-m-t-20">
      <u-cell-group>
        <u-cell-item
          :icon="menuItemList[0].icon"
          :title="menuItemList[0].name"
          @click="menuItemList[0].handleClick"
        ></u-cell-item>
      </u-cell-group>
    </view>

    <view class="u-m-t-20">
      <u-cell-group>
        <u-cell-item
          v-for="item in menuItemList.slice(1, -1)"
          :key="item.name"
          :icon="item.icon"
          :title="item.name"
          @click="item.handleClick"
        ></u-cell-item>
      </u-cell-group>
    </view>
    <view class="u-m-t-20">
      <u-cell-group>
        <u-cell-item
          :icon="menuItemList.slice(-1)[0].icon"
          :title="menuItemList.slice(-1)[0].name"
          @click="$$route({ type: 'tab', url: '/' })"
        ></u-cell-item>
      </u-cell-group>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    const route = this.$$route
    return {
      pic: 'https://uviewui.com/common/logo.png',
      menuItemList: [
        {
          name: '支付',
          icon: 'rmb-circle',
          handleClick() {
            route({ type: 'tab', url: '/' })
          }
        },
        {
          name: '收藏',
          icon: 'star',
          handleClick() {
            route({ type: 'tab', url: '/' })
          }
        },
        {
          name: '相册',
          icon: 'photo',
          handleClick() {
            route({ type: 'tab', url: '/' })
          }
        },
        {
          name: '卡券',
          icon: 'coupon',
          handleClick() {
            route({ type: 'tab', url: '/' })
          }
        },
        {
          name: '关注',
          icon: 'heart',
          handleClick() {
            route({ type: 'tab', url: '/' })
          }
        },
        {
          name: '设置',
          icon: 'setting',
          handleClick() {
            console.log('click')
            route({ type: 'tab', url: '/' })
          }
        }
      ]
    }
  },
  onLoad() {},
  methods: {}
}
</script>

<style lang="scss">
page {
  background-color: #ededed;
}

.camera {
  width: 54px;
  height: 44px;

  &:active {
    background-color: #ededed;
  }
}
.user-box {
  background-color: #fff;
}
</style>
